<!doctype html>
<html lang="en" class="fixed">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>课次课表</title>
    <link rel="apple-touch-icon" sizes="120x120" href="favicon/apple-icon-120x120.png">
    <link rel="icon" type="image/png" sizes="192x192" href="favicon/android-icon-192x192.png">
    <link rel="icon" type="image/png" sizes="32x32" href="favicon/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="favicon/favicon-16x16.png">
    <link rel="stylesheet" type="text/css"
          href="<?php xcho(loadSource('/assets/plugins/bootstrap/css/bootstrap.min.css')) ?>">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/animate.css/animate.css')) ?>">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/font-awesome/css/font-awesome.css')) ?>">
    <link rel="stylesheet"
          href="<?php xcho(loadSource('/assets/plugins/data-table/media/css/dataTables.bootstrap.min.css')) ?>">
<!--    <link rel="stylesheet" href="--><?php //xcho(loadSource('/assets/plugins/ztree/css/zTreeStyle/zTreeStyle.css')) ?><!--">-->
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/layui/css/layui.css')) ?>" media="all">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/ztree/css/metroStyle/metroStyle.css')) ?>" type="text/css">
    <link rel="stylesheet" href="<?php xcho(loadSource('/app/css/style.css')) ?>">
    <link rel="stylesheet" href="<?php xcho(loadSource('/app/css/app.css')) ?>">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/css/new_main.css')) ?>">
    <style>
        .pagination{
            margin: 0;
        }
        .content-title{
            /*width: 1200px;*/
            padding: 20px;
            background: #fff;
            margin: 0 auto;
        }
        .content-title .title{
            border-bottom: 1px #ccc solid;
            font-size: 0;
        }
        .content-title .title p{
            width: 60px;
            text-align: center;
            font-size: 14px;
            color:#108EE9;
            display: inline-block;
            position: relative;
        }
        .content-title .title p i{
            width: 70px;
            display: inline-block;
            border-bottom: 2px #108EE9 solid;
            position: absolute;
            bottom:-8px;
            left: 0;
        }
        .content-title .title ul{
            font-size: 0;
            display: inline-block;
            float: right;
            margin-top: -15px;
        }
        .content-title .range{
            margin-top: 10px;
        }
        .content-title .range .layui-form-item label{
            font-size: 12px;
            padding: 6px;
            background: #FBFBFB;
            border: 1px #E8E8E8 solid;
            margin-left: 8px;
            width: initial;
        }
        .content-title .range select{
            width: 80px;
            border: 1px #ccc solid;
            font-size: 10px;
            color:#333;
        }
        .content-title .range select option{
            font-size: 10px;
        }
        .content-title .range input{
            width: 110px;
            height: 34px;
            border: none;
            font-size: 12px;
            border:1px #ccc solid;
            border-left: none;
            text-indent: 6px;
        }
        .content-title .range div{
            display: inline-block;
            margin-bottom: 0;
        }
        .content-title .canal{
            margin-top: 5px;
        }
        .content-cont{
            /*width: 1200px;*/
            padding: 20px 20px 30px;
            background: #fff;
            margin: 30px auto;
        }
        .content-cont .top_btn .top_more{
            display: inline-block;
            position: relative;
            width: 200px;
        }
        .content-cont .top_btn .top_more button b{
            font-size: 10px;
            color:#fff;
            margin-left: 4px;
        }
        .content-cont .top_btn .top_more ul{
            width: 250px;
            text-align: center;
            padding: 10px;
            background: #fff;
            box-shadow: 0px 0px 5px #ccc;
            position: absolute;
            top: 0;
            left: 102px;
            display: none;
        }
        .content-cont .top_btn .top_more ul li {
            cursor: pointer;
            height:24px;
            line-height:24px;
            display: inline-block;

        }
        .content-cont .top_btn .top_btnRight{
            float: right;
        }
        .content-cont .top_pages{
            padding: 3px 15px;
            height: 30px;
            margin-top: 8px;
            font-size: 0;
        }
        .content-cont .top_pages p{
            display: inline-block;
            font-size: 12px;
        }
        .content-cont .top_pages ul{
            font-size: 0;
            display: inline-block;
            float: right;
        }
        .content-cont .top_pages ul li:nth-of-type(1){
            border:none;
            background: none;
        }
        .content-cont .top_pages ul li:nth-of-type(1):hover{
            background: none;
            color:#999;
        }
        .content-cont .top_pages ul li{
            display: inline-block;
            font-size: 12px;
            background: #fff;
            margin-left: 10px;
            line-height: 24px;
            text-align: center;
            border: 1px #ccc solid;
            border-radius: 6px;
            cursor: pointer;
            color:#999;
        }
        .content-cont .top_pages ul li:last-child{
            border:none;
            background: none;
        }
        .content-cont .top_pages ul li:last-child input{
            width: 50px;
            margin: 0 10px;
            border-radius: 6px;
            border: none;
            border:1px #ccc solid;
            outline: none;
        }
        .content-cont .top_pages ul li:last-child:hover{
            background: none;
            color:#999;
        }
        .content-cont .top_pages ul li:hover{
            background: #108EE9;
            color:#fff;
        }
        .content-cont .table{
            width: 100%;
            margin-top: 10px;
        }
        .content-cont .table table{
            width: 100%;
        }
        .content-cont .table table thead tr th{
            padding: 10px;
            background: #f2f2f2;
            color:#000;
            text-align: center;
            font-weight: normal;
            border: 1px #e2e2e2 solid;
        }
        .content-cont .table table tbody tr td{
            padding: 8px;
            border: 1px #e2e2e2 solid;
            text-align: center;
        }
        .content-cont .table table tbody tr td:last-child a{
            margin: 0 5px;
            position: relative;
            cursor: pointer;
        }
        .content-cont .table table tbody tr td:last-child a b{
            width: 80px;
            line-height: 24px;
            background: #fff;
            position: absolute;
            bottom: -30px;
            left: -15px;
            font-weight: normal;
            font-size: 10px;
            color:#000;
            border: 1px #ccc solid;
            border-radius: 5px;
            display: none;
            z-index: 10;
        }
        .content-cont .bottom_pages{
            padding: 3px 15px;
            height: 30px;
            margin-top: 8px;
            background: #fff;
            font-size: 0;
        }
        #begin_start_time,#end_start_time{
            height: 34px;
            border: 1px #ccc solid;
            margin-left: 6px;
        }
        .layui-anim>dt{
            cursor:pointer;
        }
        .layui-form-select .layui-select-group dd{
            padding-left: 10px;
        }
        #LAY_layuipro select{
            height: 30px;
            border-radius: 4px;
        }
        .up_area{
            margin-top: 10px;
        }
        .up_area div input{
            width: 100%;
        }
        .layui-input{
            border-radius: 0;
        }
        .content-cont .table table thead tr th a > span {
            position: relative;
        }

        .content-cont .table table thead tr th a > span i.upOrder {
            position: absolute;
            top: -4px;
            color: #888;
        }

        .content-cont .table table thead tr th a > span i.dropOrder {
            position: absolute;
            top: 5px;
            color: #888;
        }

    </style>
</head>

<body><?php include_once TPL_PATH . 'public/nav.phtml'; ?>

<div class="">
    <div class="page-body" style="padding: 0">
        <div >
            <form action="" id="keciList">
                <div class="class-box">
                    <div class="content-title">
                        <div class="layui-tab" lay-filter="config" lay-allowClose="true">
                            <div class="layui-tab-title">
                                <input type="hidden" id="view_id" name="view_id" value="">
                                <ul class="col-md-8" style="display: inline-block;">
                                    <?php if(!empty($aView)) {?>
                                        <?php foreach ($aView as $aTmp) {?>
                                            <li class="layui-this" lay-id="<?php xcho($aTmp['pk'])?>" ><?php xcho($aTmp['cfg_name'])?></li>
                                        <?php }?>
                                    <?php }?>
                                </ul>
                                <div class="input-group col-md-4">
                                    <input type="text" class="form-control"  id="keyword" name="keyword" value="<?php xcho($aSearch['keyword'])?>" placeholder="可搜索学员名">
                                    <span class="input-group-btn">
                                        <button id="search" class="btn btn-primary" url="<?php xcho($sSearchAction)?>">
                                            搜索
                                        </button>
                                    </span>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form range">
                           
                            <div class="layui-form-item">
                                <label class="layui-form-label">教材版本：</label>
                                <select name="edition" id="edition">
                                    <option value="">全部</option>
                                    <?php foreach ($edition as $aTmp) { ?>
                                        <option value="<?php xcho($aTmp['dict_value']) ?>"
                                            <?php if ($aTmp['dict_value'] == $aSearch['edition']) { ?>
                                                selected="selected"
                                            <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">课程年份：</label>
                                <select name="cyear" id="cyear">
                                    <option value="">全部</option>
                                    <?php foreach ($cyear as $aTmp) { ?>
                                        <option value="<?php xcho($aTmp['dict_value']) ?>"
                                            <?php if ($aTmp['dict_value'] == $aSearch['cyear']) { ?>
                                                selected="selected"
                                            <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">课次状态：</label>
                                <select name="make_up_status" id="make_up_status">
                                    <option value="">全部</option>
                                    <?php foreach ($make_up_status as $aTmp) { ?>
                                        <option value="<?php xcho($aTmp['dict_value']) ?>"
                                            <?php if ($aTmp['dict_value'] == $aSearch['make_up_status']) { ?>
                                                selected="selected"
                                            <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">科目：</label>
                                <select name="csubject" id="csubject">
                                    <option value="">全部</option>
                                    <?php foreach ($csubject as $aTmp) { ?>
                                        <option value="<?php xcho($aTmp['dict_value']) ?>"
                                            <?php if ($aTmp['dict_value'] == $aSearch['csubject']) { ?>
                                                selected="selected"
                                            <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">年级：</label>
                                <select name="grade" id="grade">
                                    <option value="">全部</option>
                                    <?php foreach ($grade as $aTmp) { ?>
                                        <option value="<?php xcho($aTmp['dict_value']) ?>"
                                            <?php if ($aTmp['dict_value'] == $aSearch['grade']) { ?>
                                                selected="selected"
                                            <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form range canal">
                            <div class="layui-form-item">
                                <label class="layui-form-label">课程周期：</label>
                                <select name="season" id="season">
                                    <option value="">全部</option>
                                    <?php foreach ($season as $aTmp) { ?>
                                        <option value="<?php xcho($aTmp['dict_value']) ?>"
                                            <?php if ($aTmp['dict_value'] == $aSearch['season']) { ?>
                                                selected="selected"
                                            <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">查看范围：</label>
                                <!--<select name="quiz">
                                    <option value="">全部</option>
                                    <option value="001">所有学员</option>
                                    <option value="002">我的学员</option>
                                    <option value="003">下属的学员</option>
                                    <optgroup label="我创建的学员">
                                        <option value="张">张</option>
                                        <option value="王">王</option>
                                        <option value="兆">找</option>
                                        <optgroup label="jdsklfj">
                                            <option value="张">张</option>
                                            <option value="王">王</option>
                                            <option value="兆">找</option>
                                            <option value="李">李</option>
                                        </optgroup>
                                    </optgroup>
                                </select>-->
                                <input results="s" class="group-picker" id="scale_name" name="scale_name" type="search" value="<?php xcho($aSearch['scale_name'])?>" url="<?php xcho($sSearchRange)?>">
                                <input results="s" id="scale_type" name="scale_type" type="hidden" value="<?php xcho($aSearch['scale_type'])?>">
                                <input results="s" id="scale_id" name="scale_id" type="hidden" value="<?php xcho($aSearch['scale_id'])?>">
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">课程日期：</label>
                                <select name="date_type" id="date_type" lay-filter="date_type">
                                    <option value="">全部</option>
                                    <?php foreach ($date_type as $aTmp) { ?>
                                        <option value="<?php xcho($aTmp['dict_value']) ?>"
                                            <?php if ($aTmp['dict_value'] == $aSearch['date_type']) { ?>
                                                selected="selected"
                                            <?php } ?>><?php xcho($aTmp['cn_name']) ?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="layui-inline"> <!-- 注意：这一层元素并不是必须的 -->
                                <input type="text" class="layui-input" id="begin_start_time" name="begin_start_time" value="<?php xcho($aSearch['begin_start_time'])?>" placeholder="年/月/日">
                            </div>
                            <div class="layui-inline"> <!-- 注意：这一层元素并不是必须的 -->
                                <input type="text" class="layui-input"  id="end_start_time" name="end_start_time" value="<?php xcho($aSearch['end_start_time'])?>" placeholder="年/月/日">
                            </div>
                        </div>
                        <div class="layui-form range next">
                            <div class="layui-form-item">
                                <label class="layui-form-label">教师：</label>
                                <input results="s" id="teacher_name" name="teacher_name" type="search" value="<?php xcho($aSearch['teacher_name'])?>" url="<?php xcho($sSearchTeacher)?>">
                                <input results="s" id="teacher_id" name="teacher_id" type="hidden" value="<?php xcho($aSearch['teacher_id'])?>">
                                <span class="glyphicon glyphicon-trash layui-btn layui-btn-danger layui-btn-mini" onclick="deleteData('teacher_name','teacher_id')">
                                </span>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">课程：</label>
                                <input results="s" id="course_name" name="course_name" type="search" value="<?php xcho($aSearch['course_name'])?>" url="<?php xcho($sSearchCourse)?>">
                                <input results="s" id="course_id" name="course_id" type="hidden" value="<?php xcho($aSearch['course_id'])?>">
                                <span class="glyphicon glyphicon-trash layui-btn layui-btn-danger layui-btn-mini" onclick="deleteData('course_name','course_id')"></span>
                                 <button id="search" class="btn btn-primary" url="<?php xcho($sSearchAction)?>">
                                            搜索
                                        </button>
                            </div>
                            <div class="btns-group">
                                <a class="btn btn-white" herf="javascript:"  id="save_config">保存设置</a>
                                <a class="btn btn-primary" herf="javascript:"  id="save_recover">恢复默认</a>
                            </div>

                        </div>
                    </div>
                </div>
                <div class="class-box">
                    <div class="class-box-head">
                        <div class="class-box-title">
                            <h3>课次课表</h3>
                        </div>
                        <div class="from-top row">
                            <div class="from-top-left col-md-5">
                                <ul>
                                    <li class="dropdown">
                                        <button type="button" class="btn btn-warning dropdown-toggle"
                                                    data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
                                                        aria-expanded="false">更多操作 <span class="caret"></span></button>
                                        <ul class="dropdown-menu">
                                            <?php if (isset($aActions['edits_url'])) { ?>
                                                <li id="student_attendance_status" url="<?php xcho($aActions['edits_url']) ?>"  urlSubmit="<?php xcho($aActions['saveList_url']) ?>"><a href="javascript:;">学生考勤修改</a></li>
                                            <?php } ?>
                                            <?php if (isset($aActions['edits_url'])) { ?>
                                                <li id="teacher_attendance_status"  url="<?php xcho($aActions['edits_url']) ?>"  urlSubmit="<?php xcho($aActions['saveList_url']) ?>"><a href="javascript:;">教师考勤修改</a></li>
                                            <?php } ?>
                                        </ul>
                                    </li>
                                </ul>
                            </div>
                            <div class="from-top-right col-md-7">
                                <?php if (isset($aActions['excel_url'])) { ?>
                                    <a class="layui-btn" id="excel" url="<?php xcho($aActions['excel_url']) ?>">导出课表</a>
                                <?php } ?>
                            </div>
                        </div>
                    </div>
                    <div class="row pagination-wrap">
                        <div class="col-sm-6">

                            <div class="pagination-group col-sm-12">
                                <input class="form-control" style="width: 110px;" type="number" min="1"
                                       max="<?php xcho($iMaxPage) ?>" name="now_page" placeholder="请输入页码" value="<?php xcho($iNowPage) ?>" />
                                <span>共搜索到<?php xcho($iTotalNum) ?>条记录</span>
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <ul class="pagination">
                                <?php xchoHtml($aOrderLessons->render()) ?>
                            </ul>
                        </div>
                    </div>
                    <div class="class-box-body">
                        <table class="layui-form table table-bordered table-hover table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th><input type="checkbox" lay-filter="allChoose" lay-skin="primary" name="checkAll">
                                <th style="cursor: pointer;">
                                    <a style="position: relative;"  href="<?php ($iOrderBy%2 && in_array($iOrderBy,[1,2]))?xcho($aOrderURLs[2]):xcho($aOrderURLs[1]);?>">
                                        课程日期
                                        <span style="position: absolute; top:-6px" ><i class="upOrder glyphicon glyphicon-triangle-top" style="display:
                                        <?php $iOrderBy==2?xcho('none'):xcho('block');?>"></i>
                                            <i class="dropOrder glyphicon glyphicon-triangle-bottom"style="display:
                                        <?php $iOrderBy==1?xcho('none'):xcho('block');?>"></i></span></a></th>

                                <th>星期</th>
                                <th>上课时间</th>
                                <th>学员</th>
                                <th>学员考勤</th>
                                <th style="cursor: pointer;">
                                    <a style="position: relative;" href="<?php ($iOrderBy%2 && in_array($iOrderBy,[3,4]))?xcho($aOrderURLs[4]):xcho($aOrderURLs[3]);?>">
                                        教师
                                        <span style="position: absolute; top:-6px"><i class="upOrder glyphicon glyphicon-triangle-top" style="display:
                                        <?php $iOrderBy==4?xcho('none'):xcho('block');?>"></i>
                                            <i class="dropOrder glyphicon glyphicon-triangle-bottom"style="display:
                                        <?php $iOrderBy==3?xcho('none'):xcho('block');?>"></i></span></a>
                                </th>
                                <th>教师考勤</th>
                                <th style="cursor: pointer;">
                                    <a style="position: relative;" href="<?php ($iOrderBy%2 && in_array($iOrderBy,[5,6]))?xcho($aOrderURLs[6]):xcho($aOrderURLs[5]);?>">
                                        课程名称
                                        <span style="position: absolute; top:-6px"><i class="upOrder glyphicon glyphicon-triangle-top" style="display:
                                        <?php $iOrderBy==6?xcho('none'):xcho('block');?>"></i>
                                            <i class="dropOrder glyphicon glyphicon-triangle-bottom"style="display:
                                        <?php $iOrderBy==5?xcho('none'):xcho('block');?>"></i></span></a>
                                </th>
                                <th>课程状态</th>
                                <th>小时</th>
                                <th>课次信息</th>
                                <th style="cursor: pointer;">
                                    <a style="position: relative;" href="<?php ($iOrderBy%2 && in_array($iOrderBy,[7,8]))?xcho($aOrderURLs[8]):xcho($aOrderURLs[7]);?>">
                                        cc负责人
                                        <span style="position: absolute; top:-6px"><i class="upOrder glyphicon glyphicon-triangle-top" style="display:
                                        <?php $iOrderBy==10?xcho('none'):xcho('block');?>"></i>
                                            <i class="dropOrder glyphicon glyphicon-triangle-bottom"style="display:
                                        <?php $iOrderBy==9?xcho('none'):xcho('block');?>"></i></span></a>
                                </th>
                                <th><a style="position: relative;" href="<?php ($iOrderBy%2 && in_array($iOrderBy,[9,10]))?xcho($aOrderURLs[10]):xcho($aOrderURLs[9]);?>">
                                        cr负责人
                                        <span style="position: absolute; top:-6px"><i class="upOrder glyphicon glyphicon-triangle-top" style="display:
                                        <?php $iOrderBy==10?xcho('none'):xcho('block');?>"></i>
                                            <i class="dropOrder glyphicon glyphicon-triangle-bottom"style="display:
                                        <?php $iOrderBy==9?xcho('none'):xcho('block');?>"></i></span></a></th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php foreach ($aOrderLessons as $aKey) { ?>
                                <?php foreach ($aOReserveLessons as $aLesson) { ?>
                                    <?php if ($aLesson['id'] == $aKey['id']) { ?>
                                        <tr>
                                            <td><input type="checkbox" lay-filter="itemChoose" name="ck"
                                                       lay-skin="primary" id="<?php xcho($aLesson['id']) ?>"></td>
                                            <td>
                                                <?php xcho($aLesson['lesson_date']) ?>
                                            </td>
                                            <td>
		                                        <?php xcho($aLesson['week_str']) ?>
                                            </td>
                                            <td><?php xcho($aLesson['lesson_time']) ?></td>
                                            <td>
                                                <a href="<?php xcho($aLesson['student_url']) ?>" style="color: blue">
                                                    <?php xcho($aLesson['sname']) ?>
                                                </a>
                                            </td>
                                            <td>
                                                <?php xcho($aLesson['student_attendance_status_str']) ?>
                                            </td>
                                            <td>
                                                <a href="<?php xcho($aLesson['teacher_url']) ?>" style="color: blue">
                                                    <?php xcho($aLesson['tname']) ?>
                                                </a>
                                            </td>
                                            <td>
                                                <?php xcho($aLesson['teacher_attendance_status_str']) ?>
                                            </td>
                                            <td>
                                                <a href="<?php xcho($aLesson['course_url']) ?>" style="color: blue">
                                                    <?php xcho($aLesson['cname']) ?>
                                                </a>
                                            </td>
                                            <td><?php xcho($aLesson['make_up_status_str']) ?></td>
                                            <td>
                                                <?php xcho($aLesson['times']) ?>
                                            </td>
                                            <td><?php xcho($aLesson['message']) ?></td>
                                            <td><?php xcho($aLesson['cc_name']) ?></td>
                                            <td><?php xcho($aLesson['cr_name']) ?></td>
                                            <td>
                                                <?php if (isset($aLesson['report_url'])) { ?>

                                                    <a  class="btn btn-primary" href="<?php xcho($aLesson['report_url']) ?>">
                                                      测评报告
                                                    </a>
                                                <?php } ?>
                                                <?php if (isset($aLesson['feedback_url'])) { ?>
                                                    <a class="btn btn-primary" href="javascript:;" onclick="window.open('<?php xcho($aLesson['feedback_url']) ?>')">
                                                        课后反馈
                                                    </a>
                                                <?php } ?>
                                                <br/>
                                                <?php if (isset($aLesson['add_url'])) { ?>
                                                    <a class="btn btn-primary" href="<?php xcho($aLesson['add_url']) ?>">
                                                       增加课次
                                                    </a>
                                                <?php } ?>
                                                <?php if (isset($aLesson['edit_url'])) { ?>
                                                    <a class="btn btn-primary" lay-event="edit"
                                                       href="<?php xcho($aLesson['edit_url']) ?>">
                                                        修改课次
                                                    </a>
                                                <?php } ?>
                                                <?php if (isset($aLesson['del'])) { ?>
                                                    <a class="btn btn-sub lessonDel" lay-event="del"
                                                       url="<?php xcho($aLesson['del']['del_url']); ?>"
                                                       keyid="<?php xcho($aLesson['id']) ?>"
                                                       actions="<?php xcho($aLesson['del']['actions']) ?>">
                                                        删除课次
                                                    </a>
                                                <?php } ?>
                                            </td>
                                        </tr>
                                    <?php } ?>
                                <?php } ?>
                            <?php } ?>

                                    <!--<span class="glyphicon glyphicon-file"><b>测试报告</b></span>                                   <span class="glyphicon glyphicon-comment"><b>课后反馈</b></span>
                                    <span class="glyphicon glyphicon-pencil"><b>修改课次</b></span>                                 <span class="glyphicon glyphicon-plus-sign"><b>增加课次</b></span>
                                    <span class="glyphicon glyphicon-trash"><b>删除课次</b></span>-->

                            </tbody>
                        </table>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
</div>
<div class="modal fade" id="info-modal-group" tabindex="-1" role="dialog" aria-labelledby="modal-info-label">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header state modal-info">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="modal-info-label"><i class="fa fa-info"></i></h4>
            </div>
            <div class="modal-body" style="min-height: 150px;">
                <ul id="treeDemo" class="ztree">
                    <!--<option value="">全部</option>
                    <option value="all">所有学员</option>
                    <option value="mine">我的学员</option>
                    <option value="follower">下属的学员</option>
                    <option value="create">下属的学员</option>-->
                </ul>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-info" id="sureGroup" data-dismiss="modal">确定</button>
                <button type="button" class="btn btn-default" id="returnGroup" data-dismiss="modal">返回</button>
            </div>
        </div>
    </div>
</div>
<div id="keci_modal">
    <select name="quickedit_field" class="small" style="width: 100%"">
        <!--<option value="studentKq">学生考勤修改</option>
        <option value="teacherKq" relvalue="1">老师考勤修改</option>-->
    </select>
    <div class="up_area">
        <!--<div id="quickedit_field_studentKq" uitype="1" style="display:none;">
            <input type="text" tabindex="1" name="quickedit_value_studentKq" id="studentKq" value=""
                   class="detailedViewTextBox">
        </div>
        <div id="quickedit_field_teacherKq" uitype="1" style="display:none;">
            <input type="text" tabindex="1" name="quickedit_value_teacherKq" id="teacherKq" value=""
                   class="detailedViewTextBox">
        </div>-->
    </div>
</div>
<div class="modal fade" id="config-modal" tabindex="-1" role="dialog" aria-labelledby="modal-primary-label"
     style="z-index:9999;display: none;">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header state modal-primary">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">×</span></button>
                <h4 class="modal-title" id="modal-primary-label"><i class="fa fa-user"></i>自定义快捷视图</h4>
            </div>
            <div class="modal-body layui-form" style="min-height: 150px;">
                <?php if(isset($aActions['config']) && $aActions['config'] == 'Y') {?>
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否公用</label>
                        <div class="layui-input-block">
                            <select id="is_public" name="is_public" lay-verify="required">
                                <?php foreach ($aConfirm as $aTmp) { ?>
                                    <option value="<?php xcho($aTmp['dict_value']) ?>"><?php xcho($aTmp['cn_name']) ?></option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>
                <?php }?>
                <div class="layui-form-item">
                    <label class="layui-form-label">快捷视图标题</label>
                    <div class="layui-input-block">
                        <input type="text" id="cfg_name" name="cfg_name" required
                               lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                        <input type="hidden" id="module" name="module" value="<?php xcho($sControllerModule)?>">
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <span type="button" class="btn btn-primary" id="sureConfig" data-dismiss="modal" url="<?php xcho($saveConfig)?>">保存</span>
                <span type="button" class="btn btn-default" data-dismiss="modal">关闭</span>
            </div>
        </div>
    </div>
</div>
<script src="<?php xcho(loadSource('/assets/plugins/jquery/jquery.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/layui/layui.all.js')) ?>" charset="utf-8"></script>
<script src="<?php xcho(loadSource('/assets/plugins/bootstrap/js/bootstrap.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/data-table/media/js/jquery.dataTables.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/data-table/media/js/dataTables.bootstrap.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/layer-v3.0.3/layer/layer.js')) ?>"></script>
<script
    src="<?php xcho(loadSource('/assets/plugins/data-table/extensions/Responsive/js/dataTables.responsive.min.js')) ?>"></script>
<script
    src="<?php xcho(loadSource('/assets/plugins/data-table/extensions/Responsive/js/responsive.bootstrap.min.js')) ?>"></script>
<script src="<?php xcho(loadSource('/assets/plugins/ztree/js/jquery.ztree.core.js')) ?>"></script>
<script type="text/javascript" src="<?php xcho(loadSource('/assets/plugins/ztree/js/jquery.ztree.excheck.js')) ?>"></script>
<script type="text/javascript" src="<?php xcho(loadSource('/assets/plugins/ztree/js/jquery.ztree.exedit.js')) ?>"></script>
<script>


    layui.use(['layer', 'form','laydate'], function(){
        var layer = layui.layer
            ,form = layui.form;
        var laydate = layui.laydate;
        form.on("select(date_type)",function (data) {
            var ddVal = data.value;
            if(ddVal == "define"){
                $("#begin_start_time").val("");
                $("#end_start_time").val("");
                //执行一个laydate实例
                laydate.render({
                    elem: '#end_start_time', //指定元素
                    showBottom: false
                });
                //执行一个laydate实例
                laydate.render({
                    elem: '#begin_start_time', //指定元素
                    showBottom: false,
                });
            }else{
                var aDate = getDates(ddVal);
                $("#begin_start_time").val(aDate['sStartDate']);
                $("#end_start_time").val(aDate['sEndDate']);
            }
        })
        $(".group-picker").focus(function(){
            $('#info-modal-group').modal({
                keyboard: false,
                backdrop:false
            });
            $('#info-modal-group').on('shown.bs.modal', function (e) {
                // 关键代码，如没将modal设置为 block，则$modala_dialog.height() 为零
                $(this).css('display', 'block');
                $(this).find('.modal-dialog').css({
                    'margin-top': "100px"
                });
            });
        });
        form.on('checkbox(allChoose)', function (data) {
            var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
            child.each(function (index, item) {
                item.checked = data.elem.checked;
            });
            form.render('checkbox');
        });
        form.on('checkbox(itemChoose)', function (data) {
            var sib = $(data.elem).parents('table').find('tbody input[type="checkbox"]:checked').length;
            var total = $(data.elem).parents('table').find('tbody input[type="checkbox"]').length;
            if (sib == total) {
                $(data.elem).parents('table').find('thead input[type="checkbox"]').prop("checked", true);
                form.render();
            } else {
                $(data.elem).parents('table').find('thead input[type="checkbox"]').prop("checked", false);
                form.render();
            }
        });
        var element = layui.element;

        //监听Tab切换，以改变地址hash值
        element.on('tab(config)', function(){
            $("#view_id").val(this.getAttribute('lay-id'));
            var view_all = $("#view_id").val();
            if(view_all == "nomal"){
                $("#keciList").find('input[type=text],select,input[type=checkbox]').each(function(){
                  $(this).val('');
                });
            }
            $('#keciList').submit();
        });
    });

    $(".layui-tab-close").on('click',function () {
        $.ajax({
            url: "<?php xcho($sDelView)?>",
            data: {
                id: $(this).parent().attr('lay-id')
            },
            type: 'post',
            dataType: 'json',
            success: function (data) {
                if (data.success == 1) {
                    layer.alert("删除成功!")
                } else {
                    alert(data.msg);
                }
            },
            complete: function () {
                location.reload();
            },
            error: function () {

            }
        });
    });

    //显示保存快捷视图
    $("#save_config").on("click", function () {

        $('#config-modal').modal({
            keyboard: false,
            backdrop: false
        });
        $("#select-picker").focus(function () {
            $('#config-modal').modal({
                keyboard: false,
                backdrop: false
            });
        });
    })

    //保存视图
    $("#sureConfig").on("click", function () {
        var aArrData = new Array();
        aArrData = {
            'is_public':$("#is_public").val(),
            'cfg_name':$("#cfg_name").val(),
            'module':$("#module").val(),
            'cfg_value':{
                'scale_name':$("#scale_name").val(),
                'scale_type':$("#scale_type").val(),
                'scale_id':$("#scale_id").val(),
                'csubject':$("#csubject").val(),
                'edition':$("#edition").val(),
                'grade':$("#grade").val(),
                'cyear':$("#cyear").val(),
                'season':$("#season").val(),
                'make_up_status':$("#make_up_status").val(),
                'date_type':$("#date_type").val(),
                'teacher_name':$("#teacher_name").val(),
                'teacher_id':$("#teacher_id").val(),
                'course_name':$("#course_name").val(),
                'course_id':$("#course_id").val(),
                'keyword':$("#keyword").val(),
            }
        };
        $.ajax({
            url: $("#sureConfig").attr('url'),
            type: 'post',
            data: aArrData,
            dataType: 'json',
            success: function (data) {
                if (data.success == 1) {
                    location.reload();
                } else {
                }
            },
            complete: function () {
            },
            error: function () {

            }
        });
    })

    //恢复默认视图
    $("#save_recover").on("click", function () {
        var aArrData = new Array();

        $.ajax({
            url: "<?php xcho($sRestoreView)?>",
            type: 'post',
            data: {
                'module':$("#module").val(),
            },
            dataType: 'json',
            success: function (data) {
                if (data.success == 1) {
                    location.reload();
                } else {
                }
            },
            complete: function () {
            },
            error: function () {

            }
        });
    })
    $("#excel").on('click', function () {
        var jsonData = $("form").serializeArray();
        $.ajax({
            url: $(this).attr('url'),
            data: jsonData,
            type: 'post',
            dataType: 'json',
            success: function (data) {
                if (data.success == 1) {
                    window.open(data.data);
                } else {

                }
            },
            complete: function () {
            },
            error: function () {

            }
        });
    });

    //修改学生和老师的考勤
    var arrs = [];
    $("#student_attendance_status").click(function () {
        $("table>tbody>tr>td>div").each(function () {
            if ($(this).hasClass("layui-form-checked")) {
                var checkboxID = $(this).prev("input").attr("id");
                arrs.push(checkboxID);
            }
        })
        if(arrs.length==0){
            layer.alert("至少选择一项");
        }else {
            layer.open({
                type: 1
                , title: false //不显示标题栏
                , closeBtn: false
                , area: '300px;'
                , shade: 0.8
                , id: 'LAY_layuipro' //设定一个id，防止重复弹出
                , btn: ['保存', '取消']
                , moveType: 1 //拖拽模式，0或者1
                , content: '<div style="padding: 50px; line-height: 22px;  font-weight: 300;">' +
                $("#keci_modal").html() +
                '</div>'
                , success: function (layero) {
                    arrs = arrs.unique3();//数组去重
                    var changeUrl = $("#student_attendance_status").attr("url");
                    //批量修改渲染接口
                    $.ajax({
                        url: changeUrl,
                        traditional: true,
                        type: 'POST',
                        dataType: 'json',
                        success: function (data) {
                           // console.log(data);
                            changeApply(data);//批量修改渲染
                        }
                    })
                    var select_data = {};
                    var btn = layero.find('.layui-layer-btn');
                    btn.css('text-align', 'center');
                    btn.find('.layui-layer-btn0').on("click", function () {
                        //console.log("#"+select_option)
                        //var a  = ".layui-layer-content #"+select_option;
                       // console.log($(a).val())
                        select_data[select_option] = select_option_val
                        console.log(select_data);
                         var urlSubmit = $("#student_attendance_status").attr("urlSubmit");
                         //批量修改保存接口
                         $.ajax({
                             url: urlSubmit,
                             data: {
                                 ids: arrs,
                                 data:select_data
                             },
                             type: 'POST',
                             dataType: 'json',
                             success: function (data) {
                                 if(data.success==1){
                                     $(".small").text("");
                                     $(".up_area").text("");
                                     layer.msg("修改成功");
                                     setTimeout(function(){ window.location.reload(); }, 3000);
                                 }else{
                                     layer.msg("修改失败");
                                 }
                             }
                         })
                    })
                }
            })
        }
    });
    //数组去重
    Array.prototype.unique3 = function(){
        var res = [];
        var json = {};
        for(var i = 0; i < this.length; i++){
            if(!json[this[i]]){
                res.push(this[i]);
                json[this[i]] = 1;
            }
        }
        return res;
    }
    var arr = [];
    $("#teacher_attendance_status").click(function(){
        $("table>tbody>tr>td>div").each(function () {
            if ($(this).hasClass("layui-form-checked")) {
                var checkboxID = $(this).prev("input").attr("id");
                arr.push(checkboxID);
            }
        })
        if(arr.length==0){
            layer.alert("至少选择一项");
        }else {
            layer.open({
                type: 1
                , title: false //不显示标题栏
                , closeBtn: false
                , area: '300px;'
                , shade: 0.8
                , id: 'LAY_layuipro' //设定一个id，防止重复弹出
                , btn: ['保存', '取消']
                , moveType: 1 //拖拽模式，0或者1
                , content: '<div style="padding: 50px; line-height: 22px;  font-weight: 300;">' +
                $("#keci_modal").html() +
                '</div>'
                , success: function (layero) {
                    arr = arr.unique3();
                    var changeUrl = $("#student_attendance_status").attr("url");
                    //批量修改渲染接口
                    $.ajax({
                        url: changeUrl,
                        traditional: true,
                        type: 'POST',
                        dataType: 'json',
                        success: function (data) {
                            //console.log(data);
                            changeApplys(data);//批量修改渲染
                        }
                    })
                    var select_data = {};
                    var btn = layero.find('.layui-layer-btn');
                    btn.css('text-align', 'center');
                    btn.find('.layui-layer-btn0').on("click", function () {
                        //console.log("#"+select_option)
                        var a  = ".layui-layer-content #"+select_option;
                        //console.log($(a).val())
                        select_data[select_option] = select_option_vals;
                        console.log(select_data);
                        var urlSubmit = $("#student_attendance_status").attr("urlSubmit");
                        //批量修改保存接口
                        $.ajax({
                            url: urlSubmit,
                            data: {
                                ids: arr,
                                data:select_data
                            },
                            type: 'POST',
                            dataType: 'json',
                            success: function (data) {
                                if(data.success==1){
                                    $(".small").text("");
                                    $(".up_area").text("");
                                    layer.msg("修改成功");
                                    setTimeout(function(){ window.location.reload(); }, 3000);
                                }else{
                                    layer.msg("修改失败");
                                }
                            }
                        })
                    })
                }
            })
        }
    })
    //修改学生考勤渲染
    function changeApply(data){
        var str = "<option>请选择</option>",strs = '';
        $.each(data,function(i,dataVal){
            str += '<option value='+dataVal.val+' type='+dataVal.type+'>'+dataVal.name+'</option>'
            if(dataVal.type == "text"){
                strs += '<div id="quickedit_field_'+dataVal.val+'" uitype="1" style="display:none;">'
                    +'<input type="text" tabindex="1" name="quickedit_value_'+dataVal.val+'" id="'+dataVal.val+'" value="" class="detailedViewTextBox">'
                    +'</div>'
            }else if(dataVal.type == "select"){
                strs += '<select id="quickedit_field_'+dataVal.val+'" tabindex="1811111" style="display:none;">'
                $.each(dataVal.data_list,function (n,listVal) {
                    strs += '<option value='+listVal.dict_value+'>"'+listVal.cn_name+'"</option>'
                })
                strs+='</select>'
            }
        })
        $(".small").html(str);
        $(".up_area").html(strs);
        $("#LAY_layuipro>div>select>option").eq(2).hide();
        $(".small").change(function(){
            var selectedVal = $(this).find("option:selected").attr("value");
            var e = "#quickedit_field_" + selectedVal;
            $("div[id*='quickedit_field_']").css("display", "none");
            $("select[id*='quickedit_field_']").css("display", "none");
            $("#LAY_layuipro").find(e).fadeIn();
            select_option = selectedVal;
            select_element = e;
            console.log(select_option);
            console.log(select_element);
        })
        $(".up_area>select").change(function(){
            var selectedVal_child = $(this).find("option:selected").attr("value");
            select_option_val = selectedVal_child;
        })
    }
    //修改老师考勤渲染
    function changeApplys(data){
        var str = "<option>请选择</option>",strs = '';
        $.each(data,function(i,dataVal){
            str += '<option value='+dataVal.val+' type='+dataVal.type+'>'+dataVal.name+'</option>'
            if(dataVal.type == "text"){
                strs += '<div id="quickedit_field_'+dataVal.val+'" uitype="1" style="display:none;">'
                    +'<input type="text" tabindex="1" name="quickedit_value_'+dataVal.val+'" id="'+dataVal.val+'" value="" class="detailedViewTextBox">'
                    +'</div>'
            }else if(dataVal.type == "select"){
                strs += '<select id="quickedit_field_'+dataVal.val+'" tabindex="1811111" style="display:none;">'
                $.each(dataVal.data_list,function (n,listVal) {
                    strs += '<option value='+listVal.dict_value+'>"'+listVal.cn_name+'"</option>'
                })
                strs+='</select>'
            }
        })
        $(".small").html(str);
        $(".up_area").html(strs);
        $("#LAY_layuipro>div>select>option").eq(1).hide();
        $(".small").change(function(){
            var selectedVal = $(this).find("option:selected").attr("value");
            var e = "#quickedit_field_" + selectedVal;
            $("div[id*='quickedit_field_']").css("display", "none");
            $("select[id*='quickedit_field_']").css("display", "none");
            $("#LAY_layuipro").find(e).fadeIn();
            select_option = selectedVal;
            select_element = e;
        })
        $(".up_area>select").change(function(){
            var selectedVal_childs = $(this).find("option:selected").attr("value");
            select_option_vals = selectedVal_childs;
        })
    }

    //删除
    $(".lessonDel").click(function () {
        var delVal = $(this).attr("url"),
            keyId = $(this).attr("keyid"),
            actions = $(this).attr("actions");
        layer.confirm('确定删除吗？', {icon: 3, title:'提示'}, function(index){
            $.ajax({
                url: delVal,
                data:{
                    id:keyId,
                    actions:actions
                },
                type: 'POST',
                dataType: 'json',
                success: function (data) {
                    if (data.success == 1) {
                        layer.msg('删除成功');
                        setTimeout(function(){ window.location.reload(); }, 3000);
                    } else {
                        layer.msg("删除失败");
                    }
                }
            })
        });
    })
    //搜索-form表单提交
    $("#search").click(function () {
        $("input[name='now_page']").val($("input:focus").val());
        $("#keciList").submit();
    })
    $("#search").bind('keyup', function (event) {
        if (event.keyCode == "13") {
            $("input[name='now_page']").val($("input:focus").val());
            //回车执行查询
            $('#search').click();
        }
    })
    $("table tr>td>a").hover(function(){
        $(this).find("b").show();
    },function(){
        $(this).find("b").hide();
    })

    $(".top_more").hover(function () {
        $(this).find("ul").show();
    }, function () {
        $(this).find("ul").hide();
    })
    /*$(".layui-anim>dt").click(function(){
        $(this).nextAll("dd").toggle();
    })*/
    $("#course_name").focus(function () {
        var index = layer.open({
            type: 2
            , title: false //不显示标题栏
            , closeBtn: false
            , area: 'auto'
            , shade: 0.8
            , id: 'LAY_layuipro' //设定一个id，防止重复弹出
            , btn: [ '确定','取消']
            , moveType: 1 //拖拽模式，0或者1
            , content: $(this).attr('url')
        });
        layer.full(index);
    });
    $("#teacher_name").focus(function () {
        var index = layer.open({
            type: 2
            , title: false //不显示标题栏
            , closeBtn: false
            , area: 'auto'
            , shade: 0.8
            , id: 'LAY_layuipro' //设定一个id，防止重复弹出
            , btn: [ '确定','取消']
            , moveType: 1 //拖拽模式，0或者1
            , content: $(this).attr('url')
        });
        layer.full(index);
    });

    //自动获取课程日期或者收费日期
    function getDates(sDateType) {
        var aDate = new Array();
        aDate['sStartDate'] = '';
        aDate['sEndDate'] = '';
        switch (sDateType){
            case 'month':
                aDate['sStartDate'] = '<?php $BeginDate = date("Y-m-01", strtotime(date("Y-m-d"))); xcho($BeginDate)?>';
                aDate['sEndDate'] = '<?php xcho(date("Y-m-d", strtotime("$BeginDate +1 month -1 day")))?>';
                break;
            case 'sevenday':
                aDate['sStartDate'] = '<?php xcho( date("Y-m-d", strtotime("-7 days")))?>';
                aDate['sEndDate'] = '<?php xcho( date("Y-m-d", strtotime("-1 days")))?>';
                break;
            case 'thirtyday':
                aDate['sStartDate'] = '<?php xcho( date("Y-m-d", strtotime("-30 days")))?>';
                aDate['sEndDate'] = '<?php xcho( date("Y-m-d", strtotime("-1 days")))?>';
                break;
            case 'today':
                aDate['sStartDate'] = '<?php xcho( date("Y-m-d"))?>';
                aDate['sEndDate'] = '<?php xcho( date("Y-m-d"))?>';
                break;
            case 'week':
                aDate['sStartDate'] = '<?php xcho( date("Y-m-d",strtotime("this week")))?>';
                aDate['sEndDate'] = '<?php xcho( date("Y-m-d",strtotime("this week +6 day")))?>';
                break;
            case 'tomorrow':
                aDate['sStartDate'] = '<?php xcho( date("Y-m-d", strtotime("+1 days")))?>';
                aDate['sEndDate'] = '<?php xcho( date("Y-m-d", strtotime("+1 days")))?>';
                break;
            case 'yesterday':
                aDate['sStartDate'] = '<?php xcho( date("Y-m-d", strtotime("-1 days")))?>';
                aDate['sEndDate'] = '<?php xcho( date("Y-m-d", strtotime("-1 days")))?>';
                break;
        }
        return aDate;
    }

//查看范围
    var setting = {
        view: {
            selectedMulti: false,
            addHoverDom: addHoverDom,
            removeHoverDom:removeHoverDom
        },
        edit: {
            enable: true
        },
        data: {
            keep: {
                parent:true,
                leaf:true
            },
            simpleData: {
                enable: true
            }
        },
        callback: {
            beforeDrag: beforeDrag,
            beforeRemove: beforeRemove,
//          beforeRename: beforeRename,
            onRemove: onRemove,
            onClick:zTreeOnClick
        }
    };
    var settingGroup = {
        view: {
            selectedMulti: false
        },
        edit: {
            enable: false
        },
        data: {
            keep: {
                parent:true,
                leaf:true
            },
            simpleData: {
                enable: true
            }
        }
    };
    var log, className = "dark";
    function beforeDrag(treeId, treeNodes) {
        return false;
    }
    //选中赋值到input中
    function zTreeOnClick(event,treeId,treeNode){
        // alert(treeNode.tId + "," + treeNode.name);
        $(".group-picker").val(treeNode.name);
        $("#scale_type").val(treeNode.scale_type);
        $("#scale_id").val(treeNode.id);
    }
    function beforeRemove(treeId, treeNode) {
        className = (className === "dark" ? "":"dark");
        //console.log("[ beforeRemove ]&nbsp;&nbsp;&nbsp;&nbsp; " + treeNode.name);
        var zTree = $.fn.zTree.getZTreeObj("treeDemo");
        zTree.selectNode(treeNode);
        return confirm("确认删除 " + treeNode.name + " 吗？");
    }
    var IDMark_Switch = "_switch",
        IDMark_Icon = "_ico",
        IDMark_Span = "_span",
        IDMark_Input = "_input",
        IDMark_Check = "_check",
        IDMark_Edit = "_edit",
        IDMark_Remove = "_remove",
        IDMark_Ul = "_ul",
        IDMark_A = "_a";
    function addHoverDom(treeId, treeNode) {
        if (treeNode.parentNode && treeNode.parentNode.id!=1) return;
        var aObj = $("#" + treeNode.tId + IDMark_A);
        if ($("#diyBtn_"+treeNode.id).length>0) return;
        var editStr = "<a id='diyBtn_" +treeNode.id+ "' title='"+treeNode.name+"' onfocus='this.blur();'>编辑</a>";
        aObj.append(editStr);
        var btn = $("#diyBtn_"+treeNode.id);
        if (btn) btn.bind("click", function(){
            editNode(treeNode)
        });

    }
    function removeHoverDom(treeId, treeNode) {
        $("#diyBtn_"+treeNode.id).unbind().remove();
        $("#diyBtn_space_" +treeNode.id).unbind().remove();
    };
    function onRemove(e, treeId, treeNode) {
        //console.log("onRemove ]&nbsp;&nbsp;&nbsp;&nbsp; " + treeNode.id);
        $.ajax({
            url: $("input[name='del_group_info']").val(),
            data:{
                id:treeNode.id
            },
            type: 'post',
            dataType: 'json',
            success: function (data) {
                //console.log(data)
                if(data.success == 1){
                    layer.alert("删除成功!")
                }else{
                    alert(data.msg);
                }
            },
            complete:function(){
                location.reload();
            },
            error: function () {

            }
        });
    }
    function beforeRename(treeId, treeNode, newName) {
//            if (newName.length == 0) {
//                alert("节点名称不能为空.");
//                var zTree = $.fn.zTree.getZTreeObj("treeDemo");
//                setTimeout(function(){zTree.editName(treeNode)}, 10);
//                return false;
//            }
        editNode(treeNode);
        return true;
    }

    var newCount = 1;
    function add(e) {
        var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
            isParent = e.data.isParent,
            nodes = zTree.getSelectedNodes(),
            treeNode = nodes[0];
        if (treeNode) {
            treeNode = zTree.addNodes(treeNode, {id:(100 + newCount), pId:treeNode.id, isParent:isParent, name:"new node" + (newCount++)});
        } else {
            treeNode = zTree.addNodes(null, {id:(100 + newCount), pId:0, isParent:isParent, name:"new node" + (newCount++)});
        }
        if (treeNode) {
            zTree.editName(treeNode[0]);
        } else {
            layer.alert("叶子节点被锁定，无法增加子节点");
        }
    };
    function edit() {
        var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
            nodes = zTree.getSelectedNodes(),
            treeNode = nodes[0];
        if (nodes.length == 0) {
            layer.alert("请先选择一个节点");
            return;
        }
        zTree.editName(treeNode);
    };
    function remove(e) {
        var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
            nodes = zTree.getSelectedNodes(),
            treeNode = nodes[0];
        if (nodes.length == 0) {
            layer.alert("请先选择一个节点");
            return;
        }
        var callbackFlag = $("#callbackTrigger").attr("checked");
        zTree.removeNode(treeNode, callbackFlag);
    };
    function setEdit() {
        var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
            remove = $("#remove").attr("checked"),
            removeTitle = $.trim($("#removeTitle").get(0).value);
        zTree.setting.edit.showRemoveBtn = remove;
//            zTree.setting.edit.showRenameBtn = rename;
        zTree.setting.edit.removeTitle = removeTitle;
//            zTree.setting.edit.renameTitle = renameTitle;
    }
    function clearChildren(e) {
        var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
            nodes = zTree.getSelectedNodes(),
            treeNode = nodes[0];
        if (nodes.length == 0 || !nodes[0].isParent) {
            alert("请先选择一个父节点");
            return;
        }
        zTree.removeChildNodes(treeNode);
    };
    $(document).ready(function(){
        onLoadZTree();
    });
    function onLoadZTree(){
        var treeNodes;
        $.ajax({
            url: $(".group-picker").attr('url'),
            type: 'get',
            async:false,
            dataType: 'json',
            success:function(data){
                //console.log(data);
                //请求成功后处理函数
                treeNodes = data.data_list.aGroup;//把后台封装好的简单Json格式赋给treeNodes

            }
        });
        var t = $("#treeDemo");
        t = $.fn.zTree.init(t, setting, treeNodes);
    }

    //删除教师或课程搜索条件
    function deleteData(sName,sID) {
        $("#"+sName).val("");
        $("#"+sID).val("");
    }
</script>
<?php include_once TPL_PATH . 'public/foot_script.phtml'; ?>
<button id="top" style="height: 50px;width: 50px;"></button></body>

</html>
